package com.zboot.zbootadmin.project.system.user.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zboot.zbootadmin.project.system.user.domain.SysUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * <p>
 * 用户信息表 Mapper 接口
 * </p>
 *
 * @author zyt
 * @since 2020-07-18
 */
@Repository
@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {

    /**
     * 通过用户名查询用户信息
     * @param userName
     * @return
     */
    SysUser selectUserByUserName(@Param("userName") String userName);

    /**
     *
     * @Description: 重置密码
     *
     * @author: zyt
     * @date: 10:50 2020/10/5
     * @param: [oldPassword, newPassword]
     * @return: void
     *
     */
    void resetPwd(@Param("newPassword") String newPassword,@Param("userId") String userId );

    /**
     *
     * @Description: 上传用户图片
     *
     * @author: zyt
     * @date: 22:24 2020/10/8
     * @param: [userId, avatar]
     * @return: void
     *
     */
    @Update("update sys_user set avatar=#{avatar} where user_id=#{userId}")
    void uploadPicture(@Param("userId") String userId,@Param("avatar") String avatar);
}
